#import "User.h"

@implementation RegistReq
@end
@implementation LoginReq
@end
@implementation ValidReq
@end
@implementation VioletInfo
- (instancetype) initWith:(NSDictionary*)dict{
    self = [super init];
    if (self != nil) {
//        NSLog(@"%@",dict);
        [self setAvatar:[dict objectForKey:@"Avatar"]];
        [self setBio:[dict objectForKey:@"Bio"]];
        [self setGender:[[dict objectForKey:@"Gender"]integerValue]];
        [self setName:dict[@"Name"]];
        [self setNikeName:[dict objectForKey:@"NikeName"]];
    }
    return self;
}
-(id)copy{
    VioletInfo *newInfo = [super init];
    [newInfo setName:[self Name]];
    [newInfo setAvatar:[self Avatar]];
    [newInfo setGender:[self Gender]];
    [newInfo setNikeName:[self NikeName]];
    return newInfo;
}
@end
@implementation UserInfo
- (instancetype) initWith:(NSDictionary*)dict{
    self = [super init];
    if (self != nil) {
        [self setClass:[[dict valueForKey:@"Class"]integerValue]];
        [self setEmail:[dict objectForKey:@"Email"]];
        [self setID:[dict objectForKey:@"ID"]];
//        NSLog(@"%@",dict);
        VioletInfo *info=[[VioletInfo alloc]initWith:[dict objectForKey:@"Info"]];
        [self setInfo:info];
        [self setMaxSize:[[dict valueForKey:@"MaxSize"]integerValue]];
        [self setSingleSize:[[dict valueForKey:@"SingleSize"]integerValue]];
        [self setUsedSize:[[dict objectForKey:@"UsedSize"]integerValue]];
    }
    return self;
}
-(id)copy{
    UserInfo *newInfo = [super init];
    [newInfo setClass:[self Class]];
    [newInfo setEmail:[self Email]];
    [newInfo setID:[self ID]];
    [newInfo setInfo:[[self Info]copy]];
    [newInfo setMaxSize:[self MaxSize]];
    [newInfo setSingleSize:[self SingleSize]];
    [newInfo setUsedSize:[self UsedSize]];
    return newInfo;
}
@end
